﻿<%@ Page Title="" Language="C#" MasterPageFile="~/App_form/Menu/dao_tao.master" AutoEventWireup="true" CodeFile="mon_tn.aspx.cs" Inherits="App_form_Daotao_bomon" %>

<%@ Register TagPrefix="Control" TagName="menu_phai" Src="~/App_ctr/Admin/menu_phai.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="width: 20%; float: left;">
        <Control:menu_phai runat="server" ID="menuphai" />
    </div>
    <div style="width: 79.4%; float: right;">
        <div style="background-image: url(../../CSS/images/ui-bg_glass_75_e6e6e6_1x400.png); font-weight: bold; height: 30px; border: 1px solid #d3d3d3; margin-top: 4px; text-align: center; padding-top: 8px; text-transform: uppercase;">
            Môn thi tốt nghiệp
        </div>
        <div style="padding: 40px; margin-top: 2px; border: 1px solid #d3d3d3;">
            <div style="display: table; margin: 0 auto; width: 70%; font-size: 16px;">
                <div style="padding: 20px;">
                    <div id="ndung_ct" class="clearfix">
                        <div style="width: 52%; float: left;">
                            <div style="float: left; width: 20%;">
                                <label>
                                    Năm học  :
                                </label>
                            </div>
                            <div style="float: left;">
                                <Lib:drop runat="server" ID="namhoc" DataTextField="TEN" DataValueField="MA" Width="256px" Height="25px" onClientChange="MON_TN_TIM()"></Lib:drop>
                            </div>
                             <div style="width: 94%; height: 6px; float:left;"></div>
                            <div style="float: left; width: 20%;">
                                <label>
                                    Loại ĐT  :
                                </label>
                            </div>
                            <div style="float: left;">
                                <Lib:drop runat="server" ID="loaidt" DataTextField="TEN" DataValueField="ID" Width="256px" Height="24px" ></Lib:drop>
                            </div>
                            <div style="width: 94%; height: 6px; float:left;"></div>
                            <div style="float: left; width: 20%;">
                                <label>
                                    Bộ môn  :
                                </label>
                            </div>
                            <div>
                                <Lib:drop runat="server" ID="bo_mon" Width="256px" DataTextField="TEN" DataValueField="MA" Height="24" onClientChange="PDT_MON_HOC_LKE()"></Lib:drop>
                            </div>
                            <div style="width: 91%; height: 6px;"></div>
                            <div style="float: left; width: 20%;">
                                <label>
                                    Môn  :
                                </label>
                            </div>
                            <div>
                                <Lib:drop runat="server" ID="monhoc" Width="256px" DataTextField="TEN" DataValueField="MA" Height="24" onClientChange="PDT_MON_HOC_LKE()"></Lib:drop>
                            </div>
                            <div style="width: 91%; height: 5px;"></div>
                            <div style="float: left; width: 20%;">
                                <label>
                                    Hệ số  :
                                </label>
                            </div>
                            <div>
                                <Lib:textBox runat="server" ID="hso" Width="250px" Msg="hệ số" Type="Number" />
                            </div>
                            <div style="width: 100%; height: 30px;"></div>
                            <div style="margin-left: 20px; width: 100%;">
                                <Lib:Button runat="server" ID="add" Text="Thêm mới" Width="100px" Icon="ADD" onClientClick="P_MON_TN_NH()"></Lib:Button>
                                <Lib:Button runat="server" ID="new" Text="Mới" Width="100px" Icon="NEW" onClientClick="P_MON_TN_MOI()"></Lib:Button>
                                <Lib:Button runat="server" ID="del" Text="Xóa" Width="100px" Icon="DEL" onClientClick="P_MON_TN_XOA()"></Lib:Button>
                            </div>
                        </div>

                        <div style="width: 40%; float: left;">
                            <Lib:gridView runat="server" ID="mon_tn" Width="370" Height="250" onClientCellClick="BO_MON_TN_CELL_CLICK">
                                <Columns>
                                    <Lib:Column BaseColumn="TEN" Name="Tên môn" Width="260" />
                                    <Lib:Column BaseColumn="HSO" Name="Hệ số" Width="100" />
                                </Columns>
                                <Pager>
                                    <Lib:Pager PageSize="9" />
                                </Pager>
                            </Lib:gridView>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <asp:HiddenField runat="server" ID="ma" Value="0" />
    <asp:HiddenField ID="kthuoc" runat="server" Value="0,0" />
    <script>
        //NHAP
        function MON_TN_TIM()
        {
            var nam = $("#<%=namhoc.ClientID%>").val();
            wdt_ma.FDT_MON_TN_LKE(nam, P_MON_TN_LKE_KQ, ErrorDb, ErrorTimeOut);
        }
        function P_MON_TN_NH()
        {
            var nam = $("#<%=namhoc.ClientID%>").val(), b_mon = $("#<%=monhoc.ClientID%>").val(),
                b_loaidt=$("#<%=loaidt.ClientID%>").val(),
                b_hso = $("#<%=hso.ClientID%>").val();
            wdt_ma.FDT_MON_TN_NH(nam, b_loaidt, b_mon, b_hso, P_MON_TN_LKE_KQ, ErrorDb, ErrorTimeOut);
        }
        function P_MON_TN_LKE_KQ(b_kq)
        {
            if (CheckError(b_kq)) {
                ShowError(b_kq);
                return;
            }
            var b_grid = GetGridByID("<%=mon_tn.ClientID%>");
            b_grid.dataBin(b_kq);
        }
        function P_MON_TN_XOA()
        {
            var nam = $("#<%=namhoc.ClientID%>").val(), b_mon = $("#<%=monhoc.ClientID%>").val();
            wdt_ma.FDT_MON_TN_XOA(nam, b_mon, P_MON_TN_LKE_KQ, ErrorDb, ErrorTimeOut);
        }
        function PDT_MON_HOC_LKE() {
            try {
                bo_mon = $("#<%=bo_mon.ClientID%>").val()
                wdt_ma.FDT_MON_LKE(bo_mon, P_MON_LKE_KQ, ErrorDb, ErrorTimeOut);
                return false;
            }

            catch (err) {
                ShowError(err);
            }
        }
        function P_MON_LKE_KQ(b_kq) {
            if (CheckError(b_kq)) {
                ShowError(b_kq);
                return;
            }
            var grid = GetGridByID("<%=monhoc.ClientID%>");
            grid.dataBin(b_kq);
            return false;
        }

        function P_MON_TN_MOI()
        {
            $("#<%=hso.ClientID%>").val("");
        }
        //ACTIVE ROW
        function BO_MON_TN_CELL_CLICK(row, cell, val) {
            try {
                var grid = GetGridByID("<%=mon_tn.ClientID%>");
                var aVal = grid.getValueActive();
                if (aVal.NAM_ID == "")
                    return;
                $("#<%=monhoc.ClientID%>").val(aVal.MON_ID);  
                $("#<%=loaidt.ClientID%>").val(aVal.HE_DT);
                $("#<%=hso.ClientID%>").val(aVal.HSO);
                $("#<%=bo_mon.ClientID%>").val(aVal.ID_BM);
            }
            catch (e)
            { Msg.Show("Thông báo", e.message, "error"); }
        }
    </script>
</asp:Content>

